package com.example.musicwebcon.model;

import jakarta.persistence.*;

@Entity
@Table(name = "userinfo")
public class UserInfo {
    @Id
    @Column(name = "info_id", length = 10, nullable = false)
    private String infoId; // 对应 user 表的 user_id

    @Column(name = "nickname", length = 50, nullable = false)
    private String nickname;

    @Enumerated(EnumType.STRING)
    @Column(name = "gender", columnDefinition = "ENUM('男','女','未知') DEFAULT '未知'")
    private User.Gender gender;

    @Column(name = "signature", length = 255, nullable = true)
    private String signature;

    @Column(name = "birthday", nullable = true)
    private String birthday;

    @Column(name = "avatar", length = 8000, nullable = true)
    private String avatar;

    // Getter 和 Setter 方法
    public String getInfoId() {
        return infoId;
    }

    public void setInfoId(String infoId) {
        this.infoId = infoId;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public User.Gender getGender() {
        return gender;
    }

    public void setGender(User.Gender gender) {
        this.gender = gender;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    @Override
    public String toString() {
        return "UserInfo{" +
                "infoId='" + infoId + '\'' +
                ", nickname='" + nickname + '\'' +
                ", gender='" + gender + '\'' +
                ", signature='" + signature + '\'' +
                ", birthday='" + birthday + '\'' +
                ", avatar='" + avatar + '\'' +
                '}';
    }
}
